package be.kuleuven.mume.query;

import javax.jdo.PersistenceManager;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

public class DeleteQueryHelper extends QueryHelper<Boolean>{

	private String keyString;
	private Class<?> t;
	
	public DeleteQueryHelper(String keyString, Class<?> t) {
		this.keyString = keyString;
		this.t = t;
	}
	
	@Override
	public Boolean execute(PersistenceManager pm) {
		Key persoonkey = KeyFactory.stringToKey(keyString);
		Object o = pm.getObjectById(t,persoonkey);
		pm.deletePersistent(o);
		return true;
	}
	
}
